<?php

/**
 * Name: 反馈控制器
 * User: Silent
 * Date: 2025-10-11
 * Time: 22:09:12
 */

namespace App\Http\Controllers\V1\Resources\Message;

use App\Http\Controllers\Controller;
use App\Http\Requests\Message\FeedbackRequest;
use App\Services\Message\FeedbackService;

class FeedbackController extends Controller
{
    protected $service;

    protected $repository;

    protected $teams;

    protected $positions;

    public function __construct(FeedbackService $service)
    {
        $this->service = $service;
    }

    /**
     * 添加风险源.
     *
     * @param FeedbackRequest $request
     * @return array
     */
    public function add(FeedbackRequest $request)
    {
        $inputs = $request->validated();
        $result = $this->service->add($inputs);

        if ($result['success']) {
            return $this->_success($result['message'], $result['data'] ?? null);
        }

        return $this->_error($result['message']);
    }
}
